using UnityEngine;

public class TargetZone : MonoBehaviour
{
    [Header("参数")]
    public int scoreMultiplier = 1;

    private ScoreManager scoreManager;

    private void Start()
    {
        // 查找分数管理器
        scoreManager = FindObjectOfType<ScoreManager>();
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Dart"))
        {
            // 增加分数
            if (scoreManager != null)
            {
                scoreManager.AddScore(scoreMultiplier);
            }

            // 禁用飞镖物理
            Rigidbody dartRb = other.GetComponent<Rigidbody>();
            if (dartRb != null)
            {
                dartRb.isKinematic = true;
            }

            // 将飞镖固定在目标上
            other.transform.SetParent(transform);
        }
    }
}